<%--
  Created by IntelliJ IDEA.
  User: acoffee
  Date: 2021/10/28
  Time: 17:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>首页_蜗牛图书商城</title>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/css/index.css">
    <script src="${pageContext.request.contextPath}/js/jquery-3.4.1.js"></script>

    <script>
        $(function () {
            $.post("${pageContext.request.contextPath}/goods/queryNewGoods", "", function (data) {
                var newest = $("#newest");
                var str = "";
                for (var i in data) {
                    str += '<li style="overflow: hidden">' +
                        '<a href="${pageContext.request.contextPath}/goods/details?id=' + data[i].id + '" target="_self">' +
                        '<img src="${pageContext.request.contextPath}/' + data[i].image + '" width="175" height="175" alt="' + data[i].name + '" title="' + data[i].name + '"></a>' +
                        '<p class="pro_title">' +
                        '<a title="' + data[i].name + '" href="${pageContext.request.contextPath}/goods/details?id=' + data[i].id + '">' + data[i].name + '</a>' +
                        '</p>' +
                        '<p class="brown"> 惊喜价：￥<b>' + data[i].salesPrice + '</b></p>' +
                        '<p class="light_gray"> 市场价： ￥<del>' + data[i].marketprice + '</del></p></li>';
                }
                newest.append(str);
            }, "json")
        })

        $(function () {
            $.post("${pageContext.request.contextPath}/goods/queryHotGoods", "", function (data) {
                var hot = $("#hot");
                var str = "";

                for (var i in data) {
                    str += '<li><a href="goodsDetail.html?gid=1">' +
                        '<img src="${pageContext.request.contextPath}/' + data[i].image + '" width="85" height="85" alt="' + data[i].name + '" title="' + data[i].name + '"></a>' +
                        '<p class="pro_title"><a href="goodsDetail.html?gid=1">' + data[i].name + '</a></p>' +
                        '<p class="brown"> ￥<b>' + data[i].salesPrice + '</b></p></li>'
                }
                hot.append(str);
            }, "json")
        })

        $(function () {
            $.post("${pageContext.request.contextPath}/category/queryAllCategory", "", function (data) {
                var goodsType = $("#goodsType");
                var str = "";
                for (var i in data) {
                    str += '<li><a href="${pageContext.request.contextPath}/goods/queryPageByCid?cid=' + data[i].id + '&currentPage=1">' + data[i].name + '</a></li>'
                }
                goodsType.append(str);
            }, "json")
        })

        function quit() {
            location.href = "${pageContext.request.contextPath}/user/quit"
        }
    </script>
</head>

<body class="index">
<div class="container">
    <%@ include file="/common/page_top.jsp" %>
    <div class="searchbar">
        <div class="allsort">
            <a href="javascript:void(0);"></a>
        </div>

        <div class="searchbox">
            <!-- <form method='get' action='#'> -->
            <input class="text" type="text" name="q" autocomplete="off" placeholder="" id="word"> <input
                class="btn" type="submit" value="搜索" id="search-btn">
            <!-- </form> -->

        </div>
        <div class="hotwords">
            <%--热门搜索：<a href="#">Java</a>--%>
        </div>
    </div>

    <div class="wrapper clearfix">
        <div class="sidebar f_r">
            <!--热卖商品-->
            <div class="hot box m_10">
                <div class="title">
                    <h2>热卖商品</h2>
                </div>
                <div class="cont clearfix">
                    <ul class="prolist" id="hot">
                    </ul>
                </div>
            </div>
            <!--热卖商品-->
        </div>
        <div class="main f_l">
            <!--最新商品-->
            <div class="box yellow m_10">
                <div class="title title3">
                    <h2>
                        <img src="${pageContext.request.contextPath}/images/front/new_product.gif" alt="最新商品"
                             width="160" height="36">
                    </h2>
                    <%--<a class="more" href="goods.html?gtid=0">更多商品...</a>--%>
                </div>
                <div class="cont clearfix">
                    <ul class="prolist" id="newest">
                    </ul>
                </div>
            </div>

        </div>
    </div>
    <div class="help m_10">
        <div class="cont clearfix">
            <dl>
                <dt>
                    <a href="">购物指南</a>
                </dt>
                <dd>
                    <a href="">订单状态</a>
                </dd>
                <dd>
                    <a href="">购物流程</a>
                </dd>
            </dl>
            <dl>
                <dt>
                    <a href="">支付帮助</a>
                </dt>
                <dd>
                    <a href="">支付帮助</a>
                </dd>
                <dd>
                    <a href="">在线支付</a>
                </dd>
                <dd>
                    <a href="">货到付款</a>
                </dd>
            </dl>
            <dl>
                <dt>
                    <a href="">配送帮助</a>
                </dt>
                <dd>
                    <a href="">EMS/邮政普包</a>
                </dd>
                <dd>
                    <a href="">商品验货与签收</a>
                </dd>
                <dd>
                    <a href="">配送范围及运费</a>
                </dd>
            </dl>
            <dl>
                <dt>
                    <a href="">售后服务</a>
                </dt>
                <dd>
                    <a href="">售后服务</a>
                </dd>
                <dd>
                    <a href="">发票制度</a>
                </dd>
                <dd>
                    <a href="">退货说明</a>
                </dd>
                <dd>
                    <a href="">换货说明</a>
                </dd>
            </dl>
            <dl>
                <dt>
                    <a href="">帮助信息</a>
                </dt>
                <dd>
                    <a href="">友情链接</a>
                </dd>
                <dd>
                    <a href="">联系客服</a>
                </dd>
                <dd>
                    <a href="">找回密码</a>
                </dd>
                <dd>
                    <a href="">关于我们</a>
                </dd>
            </dl>
        </div>
    </div>
    <div class="footer">
        <%--<p class="links">--%>
            <%--<a href="">关于我们</a>|<a href="">常见问题</a>|<a href="">安全交易</a>|<a href="">购买流程</a>|<a href="">如何付款</a>|<a--%>
                <%--href="">联系我们</a>|<a href="">合作提案</a>--%>
        <%--</p>--%>
    </div>
</div>

</body>
</html>
